﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageCom.ImageEn;
using Leadtools;
using LTDInterop;

namespace ImageCom
{
    public static class LdComToNet
    {

        public static Leadtools.RasterImage NetRasterImageFromFile(string inpath)
        {
         //var intPtr=  ImageEnExt.CreateDIBImage(inpath);
          var  intPtr= ImageComEx.LoadBigImageToDibObj(inpath);
           Leadtools.RasterImage rtnImage = NetRasterImageFromDib(intPtr.Ptr);
            ImageComEx.FreeDib((int)intPtr.Ptr);
            return rtnImage;
        }

        public static  Leadtools.RasterImage NetRasterImageFromDib(IntPtr intPtr)
        {
           LTDInterop.RasterImage ldcomImage= LdComPackage.CreateImageFromDib((int) intPtr);
            return NetRasterImageFromLtdImage(ldcomImage);
        }

        public static Leadtools.RasterImage NetRasterImageFromLtdImage(LTDInterop.RasterImage inImage)
        {
            Leadtools.RasterImage image = (Leadtools.RasterImage)inImage.TheObject;
            return image;
        }
    }
}
